package cn.wangsy.zhidao.p20170328;

import java.util.Scanner;

public class BubbleSort {
	int A[] = new int[3];
	Scanner input = new Scanner(System.in);

	public BubbleSort() {
		
	}
	
	BubbleSort(int a1, int a2, int a3) {
		A[0] = a1;
		A[1] = a2;
		A[2] = a3;
	}

	public void input(){
		System.out.println("请输入第一个数：");
		A[0] = input.nextInt();
		System.out.println("请输入第二个数：");
		A[1] = input.nextInt();
		System.out.println("请输入第三个数：");
		A[2] = input.nextInt();
	}
	
	public void Sort() {
		int t = 0;
		if (A[1] < A[0]) {
			t = A[0];
			A[0] = A[1];
			A[2] = t;
		}
		if (A[2] < A[0]) {
			t = A[0];
			A[0] = A[2];
			A[2] = t;

		}
		if (A[2] < A[1]) {
			t = A[1];
			A[1] = A[2];
			A[2] = t;
		}
		System.out.println("A[0]=" + A[0] + ",A[1]=" + A[1] + ",A[2]=" + A[2]);
	}

	void dispaly() {
		System.out.println("排序：a1,a2,a3");
	}

	public static void main(String[] args) {
		//BubbleSort c1 = new BubbleSort(4, 5, 6);
		BubbleSort c1 = new BubbleSort();
		c1.input();
		c1.dispaly();
		c1.Sort();

	}
}
